package control
{
	import flash.display.Shape;
	import flash.geom.Point;

	public class SimpleRectangle extends SimpleShape
	{
		public function SimpleRectangle(latlngs:Array,option:DrawOptions)
		{
			super();
			this.cloud = new Shape();
			this.latlngs = latlngs;
			this.addChild(cloud);
			if(option != null)
				this.option = option;
		}
		
		
		protected override function draw():void
		{
			try
			{
				this.cloud.graphics.clear();
				
				cloud.graphics.lineStyle(option.lineWidth,option.drawColor,option.ancho);
				
				
				var point1:Point = this.pane.fromLatLngToPaneCoords(this.latlngs[0]);
				var point2:Point = this.pane.fromLatLngToPaneCoords(this.latlngs[1]);
				
			
				var widthR:Number = Math.abs(point2.x - point1.x);
				var heightR:Number = Math.abs(point2.y - point1.y); 
				
				cloud.graphics.beginFill(option.fillColor,option.ancho);
				
				cloud.graphics.drawRect(point1.x,point1.y,widthR,heightR);
				
				cloud.graphics.endFill();
			}catch(e:Error)
			{
				trace("SimpleCircle.as line 43 error " + e.toString())
			}
		}
	}
}